package com.example.tys.myplayer;

import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.SurfaceView;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {



    private SurfaceView sv;
    private DavidPlayer davidPlayer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Example of a call to a native method
        sv= (SurfaceView) findViewById(R.id.sv);
        davidPlayer = new DavidPlayer();
        davidPlayer.setSurfaceView(sv);
    }

    /**
     * A native method that is implemented by the 'native-lib' native library,
     * which is packaged with this application.
     */

    public void play(View view) {
        davidPlayer.playJava(Environment.getExternalStorageDirectory() +"/x264-8bit-280K.mp4");
    }
    public void playFromNet(View view) {
//        davidPlayer.playJava(Environment.getExternalStorageDirectory() +"/Download/input.mp3");//Titanic.mkv

        davidPlayer.playJava("rtmp://live.hkstv.hk.lxdns.com/live/hks");

    }

    public void pause(View view) {
        davidPlayer.pause();
    }

}
